/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="article")
public class Article implements Serializable {
	public Article() {
	}
	
	private cn.imvc.app.entities.ArticleClass articleClass;
	
	private int id;
	
	private String url;
	
	private Byte isShow = new Byte("1");
	
	private Byte sort = new Byte("1");
	
	private String title;
	
	private String content;
	
	private java.util.Date time;
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_ARTICLE_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_ARTICLE_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 跳转地址
	 */
	public void setUrl(String value) {
		this.url = value;
	}
	
	/**
	 * 跳转地址
	 */
	@Column(name="url", nullable=true, length=255)	
	public String getUrl() {
		return url;
	}
	
	/**
	 * 是否显示，0为否，1为是，默认为1
	 */
	public void setIsShow(byte value) {
		setIsShow(new Byte(value));
	}
	
	/**
	 * 是否显示，0为否，1为是，默认为1
	 */
	public void setIsShow(Byte value) {
		this.isShow = value;
	}
	
	/**
	 * 是否显示，0为否，1为是，默认为1
	 */
	@Column(name="isShow", nullable=true)	
	public Byte getIsShow() {
		return isShow;
	}
	
	/**
	 * 排序
	 */
	public void setSort(byte value) {
		setSort(new Byte(value));
	}
	
	/**
	 * 排序
	 */
	public void setSort(Byte value) {
		this.sort = value;
	}
	
	/**
	 * 排序
	 */
	@Column(name="sort", nullable=true)	
	public Byte getSort() {
		return sort;
	}
	
	/**
	 * 标题
	 */
	public void setTitle(String value) {
		this.title = value;
	}
	
	/**
	 * 标题
	 */
	@Column(name="title", nullable=true, length=255)	
	public String getTitle() {
		return title;
	}
	
	/**
	 * 内容
	 */
	public void setContent(String value) {
		this.content = value;
	}
	
	/**
	 * 内容
	 */
	@Column(name="content", nullable=true)	
	public String getContent() {
		return content;
	}
	
	/**
	 * 发布时间
	 */
	public void setTime(java.util.Date value) {
		this.time = value;
	}
	
	/**
	 * 发布时间
	 */
	@Column(name="time", nullable=true)	
	@Temporal(TemporalType.TIMESTAMP)	
	public java.util.Date getTime() {
		return time;
	}
	
	public void setArticleClass(cn.imvc.app.entities.ArticleClass value) {
		this.articleClass = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.ArticleClass.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="articleClassId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.ArticleClass getArticleClass() {
		return articleClass;
	}
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("Article[ ");
			if (getArticleClass() != null)
				sb.append("ArticleClass.Persist_ID=").append(getArticleClass().toString(true)).append(" ");
			else
				sb.append("ArticleClass=null ");
			sb.append("Id=").append(getId()).append(" ");
			sb.append("Url=").append(getUrl()).append(" ");
			sb.append("IsShow=").append(getIsShow()).append(" ");
			sb.append("Sort=").append(getSort()).append(" ");
			sb.append("Title=").append(getTitle()).append(" ");
			sb.append("Content=").append(getContent()).append(" ");
			sb.append("Time=").append(getTime()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
